<template>
  <div id="Detail">
      <van-nav-bar
          title="订单详情"
          left-arrow
          :fixed=true
          :border=true
          @click-left="$router.go(-1)"
       ></van-nav-bar>
       <div class="select">
             <table>
                <tr><td>序号</td><td>蔬菜名</td><td>数量</td><td>价格/斤</td></tr>
                <tr  v-for="(item,index) in tableDate" :key="item.id">
                   <td>{{item.xuhao}}</td>
                   <td>{{item.name}}</td>
                   <td>{{item.num}}</td>
                   <td>{{item.price}}</td>
                </tr>
             </table>
        </div>
         <!-- 路由的出口 -->
       <transition name="router-slider" mode="out-in">
            <router-view></router-view>
      </transition>
  </div>
</template>

<script>

 import { getDetail } from './../../../../service/api/index.js'
	export default{
     name:"Pay",
     data(){
         return{
             show:false,
          startTime: '',// 开始时间
          showStart: false, // 用来显示弹出层
          time:false, //鲜活类蔬菜送达时间选择的显示
           tableDate:[],
         }
     },
      
      mounted(){
         console.log(this.$route);
      },

      computed:{
          
           minhours(){
             return  (new Date()).getHours()+1;
           }
     },
           created(){    
                       getDetail(this.$route.params.bianhao).then((response)=>{
                         console.log(response);
                              if (response.success) {
                               this.tableDate = response.data;
                              }          
                        }).catch(error=>{
                           // todo......
                            console.log(error);
                      })   



           },
     methods:{
    
            showStartTime() {
                this.showStart = true;
            },
           confirmStartFn() { // 确定按钮
              this.showStart = false;
            },
            cancelFn(){
              this.showStart = false;
          },

            async submit(){
                //付款操作
                 let result = await payOrder(this.$route.params.oid,this.startTime);
                   console.log(result);
                  if (result.status==='200') {
                        //付款成功提示
                          Toast.success('支付成功');
                        //跳转到支付成功页面
                          this.$router.push({
                            name:'paysuccess'
                      })
                  }

            }
     }

	}
</script>


<style lang="less" scoped>
     #Detail{
     	position:fixed;
     	top:0;
     	left:0;
     	bottom:0;
     	right:0;
     	background-color:#f5f5f5;
     	z-index:200;
      overflow-y: scroll;

     }

     .select{
      margin-left:3rem;
     	margin-top:3.2rem;
    	width:100%;

     }

    .router-slider-enter-active,.router-slider-leave-active{
      transition:all 0.3s;
    }

    .router-slider-enter,.router-slider-leave-active{
      transform:translate3d(2rem,0,0);
      opacity:0;
    }
</style>